package com.learn.mybatis.config;

import com.learn.mybatis.MyBatisConnection;
import com.learn.mybatis.MyBatsiTemplate;
import com.learn.mybatis.annotation.ConditionalOnLearn;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

/**
 * 自动装配
 * @author:         cong zhi
 * @createDate:     2023/2/27 17:08
 * @updateUser:     cong zhi
 * @updateDate:     2023/2/27 17:08
 * @updateRemark:   修改内容
 * @version:        v1.0
 */
@Configuration
@EnableConfigurationProperties({MybatisProperties.class})
public class LearnMyBatisAutoConfiguration {

    @Bean
    @ConditionalOnLearn // 如果添加了这个注解，到底要不要装配？ 取决于OnJackCondition 的返回值
    public MyBatisConnection myBatisConnection() {
        return new MyBatisConnection();
    }

    @Bean
    public MyBatsiTemplate myBatsiTemplate() {
        return new MyBatsiTemplate();
    }

}
